﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Cesave.Infrastructure.CrossCutting.IoC;

namespace Cesave.Infrastructure.CrossCutting.Tests
{
    [TestClass]
    public class IoCTests
    {
        [TestMethod]
        public void ShortLivedManager_IsTransient_Test()
        {
            //Arrange
            ShortLivedObject actual = IoCFactory.Resolve<ShortLivedObject>();

            //Act
            actual.Dispose();
            ShortLivedObject newShortLivedObject = IoCFactory.Resolve<ShortLivedObject>();
            //Assert
            Assert.AreNotEqual(actual, newShortLivedObject);
            Assert.IsFalse(newShortLivedObject.IsDisposed);
        }
    }
}
